CC = gcc
CFLAGS = -Wall -O2
LDFLAGS =
TARGET = epkg-helper

SRCDIR = src
INCDIR =

SRCS = $(wildcard $(SRCDIR)/*.c)
OBJS = $(SRCS:.c=.o)
all: $(TARGET)

$(TARGET): $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $@

%.o: $(SRCDIR)/%.c
	$(CC) $(CFLAGS) -c $< -o $@

DESTDIR ?= /
PREFIX ?= /usr
BINDIR = $(PREFIX)/bin

install: $(TARGET)
	install -d $(DESTDIR)$(BINDIR)
	install -m 4755 $(TARGET) $(DESTDIR)$(BINDIR)/
	
uninstall:
	rm -f $(DESTDIR)$(BINDIR)/$(TARGET)

clean:
	rm -f $(OBJS) $(TARGET)

.PHONY: all clean install uninstall help